package com.ruoyi.launch.service.impl;

import java.util.List;

import com.ruoyi.launch.mapper.EAdvertisementesMapper;
import com.ruoyi.launch.service.IEAdvertisementesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.launch.mapper.EAdvertisementMapper;
import com.ruoyi.launch.domain.EAdvertisement;
import com.ruoyi.launch.service.IEAdvertisementService;

/**
 * 智能柜待机广告Service业务层处理
 *
 * @author ruoyi
 * @date 2024-11-30
 */
@Service
public class EAdvertisementesServiceImpl implements IEAdvertisementesService
{
    @Autowired
    private EAdvertisementesMapper eAdvertisementesMapper;

    /**
     * 查询智能柜分屏广告
     *
     * @param id 智能柜分屏广告主键
     * @return 智能柜分屏广告
     */
    @Override
    public EAdvertisement selectEAdvertisementesById(Integer id)
    {
        return eAdvertisementesMapper.selectEAdvertisementesById(id);
    }

    /**
     * 查询智能柜分屏广告列表
     *
     * @param eAdvertisement 智能柜分屏广告
     * @return 智能柜分屏广告
     */
    @Override
    public List<EAdvertisement> selectEAdvertisementesList(EAdvertisement eAdvertisement)
    {
        return eAdvertisementesMapper.selectEAdvertisementesList(eAdvertisement);
    }

    /**
     * 新增智能柜分屏广告
     *
     * @param eAdvertisement 智能柜分屏广告
     * @return 结果
     */
    @Override
    public int insertEAdvertisementes(EAdvertisement eAdvertisement)
    {
       eAdvertisement.setDuration(10);
       eAdvertisement.setType(2);
        return eAdvertisementesMapper.insertEAdvertisementes(eAdvertisement);
    }

    /**
     * 修改智能柜分屏广告
     *
     * @param eAdvertisement 智能柜分屏广告
     * @return 结果
     */
    @Override
    public int updateEAdvertisementes(EAdvertisement eAdvertisement)
    {
        return eAdvertisementesMapper.updateEAdvertisementes(eAdvertisement);
    }

    /**
     * 批量删除智能柜分屏广告
     *
     * @param ids 需要删除的智能柜分屏广告主键
     * @return 结果
     */
    @Override
    public int deleteEAdvertisementesByIds(Integer[] ids)
    {
        return eAdvertisementesMapper.deleteEAdvertisementesByIds(ids);
    }

    /**
     * 删除智能柜分屏广告信息
     *
     * @param id 智能柜分屏广告主键
     * @return 结果
     */
    @Override
    public int deleteEAdvertisementesById(Integer id)
    {
        return eAdvertisementesMapper.deleteEAdvertisementesById(id);
    }

    @Override
    public int upPushStatus(Integer id) {
        EAdvertisement eAdvertisement = eAdvertisementesMapper.selectEAdvertisementesById(id);
        eAdvertisement.setStatus(1);
        return eAdvertisementesMapper.updateEAdvertisementes(eAdvertisement);
    }

    @Override
    public int downPushStatus(Integer id) {
        EAdvertisement eAdvertisement = eAdvertisementesMapper.selectEAdvertisementesById(id);
        eAdvertisement.setStatus(2);
        return eAdvertisementesMapper.updateEAdvertisementes(eAdvertisement);
    }

    @Override
    public int pushTime(EAdvertisement eAdvertisement) {

        return eAdvertisementesMapper.updateEAdvertisementes(eAdvertisement);
    }
}
